package org.xtframe.sql.verify;

import java.util.List;

import net.sf.json.JSONObject;

import org.xtframe.sql.PreparedParameter;
import org.xtframe.sql.SqlDataVerify.VerifyType;
import org.xtframe.sql.VerifyBase;

public class PreparedVerify implements VerifyBase {
	private int position = -1;
	
	private int sequen = -1;

	public void init(JSONObject data) {
		if(data.has("position")) this.position = data.optInt("position");
		if(data.has("sequen")) this.sequen = data.optInt("sequen");
	}

	public int getPosition() {
		return this.position;
	}

	public VerifyType getXtype() {
		return VerifyType.replace;
	}

	public boolean check(List<String> parameters) {
		return false;
	}

	public String replace(List<String> parameters, List<PreparedParameter> preparedParameters) {
		String o = parameters.get(position);
		preparedParameters.add(new PreparedParameter("string", sequen, o));
		return "?";
	}
}
